import unittest

from HTMLTestRunner.HTMLTestRunner import HTMLTestRunner

from config import  BASE_PATH
from scripts.test01_RegLogin import TestRegLogin
from scripts.test02_OpenAccount import TestOpenAccount
from scripts.test03_TestRecharge import TestRecharge

# 实列化测试套件
from scripts.test04_tenderApi import TestTender

suite = unittest.TestSuite()

# 添加测试类

suite.addTest(unittest.makeSuite(TestRegLogin))
suite.addTest(unittest.makeSuite(TestOpenAccount))
suite.addTest(unittest.makeSuite(TestRecharge))
suite.addTest(unittest.makeSuite(TestTender))

# 实例化TextTestRunner类
# runner = unittest.TextTestRunner()
# 定义测试报告存放的目录
report_path = BASE_PATH + '/report/report.html'

# 将测试结果写入到测试报告中


with open(report_path, mode="wb") as f:
    # 实例化HTMLTestRunner类
    runner = HTMLTestRunner(f)
    # 运行测试套件
    runner.run(suite)
